package com.flash.javamate.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author sunyiming
 * @date 2018/8/10
 */
@Controller
@RequestMapping("getip")
public class GetIpController {

    @RequestMapping
    @ResponseBody()
    public String getIp(HttpServletRequest request){
        System.out.println(request.getRemoteUser());
        System.out.println(request.getRemoteAddr());
        System.out.println(request.getRemoteHost());
        System.out.println(request.getRemotePort());
        //System.out.println(JSONObject.toJSONString(request));
        return request.getRemoteAddr();
    }

}
